/*
 *
 *  * Copyright (c) 2020-2023, Lykan (jiashuomeng@gmail.com).
 *  * <p>
 *  * Licensed under the Apache License, Version 2.0 (the "License");
 *  * you may not use this file except in compliance with the License.
 *  * You may obtain a copy of the License at
 *  * <p>
 *  *     http://www.apache.org/licenses/LICENSE-2.0
 *  * <p>
 *  * Unless required by applicable law or agreed to in writing, software
 *  * distributed under the License is distributed on an "AS IS" BASIS,
 *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  * See the License for the specific language governing permissions and
 *  * limitations under the License.
 *
 */
package cn.kstry.framework.core.kv;

import java.util.List;
import java.util.Optional;

/**
 * 键值获取能力定义
 *
 * @author lykan
 */
public interface KvAbility extends KValue {

    /**
     * 指定 scope 获取值变量
     *
     * @param scope scope
     * @param key key
     * @return 值
     */
    Optional<Object> getValueByScope(String scope, String key);

    /**
     * 获取值变量
     *
     * @param key key
     * @param clazz 值类型
     * @return 值
     */
    <T> Optional<T> getObject(String key, Class<T> clazz);

    /**
     * 获取String类型值变量
     *
     * @param key key
     * @return 值
     */
    Optional<String> getString(String key);

    /**
     * 获取List类型值变量
     *
     * @param key key
     * @param clazz list项类型
     * @return 值
     */
    <T> List<T> getList(String key, Class<T> clazz);
}
